// src/store/modules/settingsSlice.ts

import { createSlice, PayloadAction } from "@reduxjs/toolkit";

interface SettingsState {
  darkMode: boolean;
  sidebarCollapsed: boolean;
}

const initialState: SettingsState = {
  darkMode: false,
  sidebarCollapsed: false,
};

const settingsSlice = createSlice({
  name: "settings",
  initialState,
  reducers: {
    toggleDarkMode(state) {
      state.darkMode = !state.darkMode;
    },
    setSidebarCollapsed(state, action: PayloadAction<boolean>) {
      state.sidebarCollapsed = action.payload;
    },
  },
});

export const { toggleDarkMode, setSidebarCollapsed } = settingsSlice.actions;
export default settingsSlice.reducer;
